$(document).ready(function(){
	//异步加载通知公告
	//initPageInfo();
	var yjid = $('#yjid').val();
	var ejid = $('#ejid').val();
	
	$(".pagination").createPage({
        pageCount : $("#totalPage").val(),
        current : $("#page").val(),
        backFn : function(page){
        	window.location.href = mainDomain + "/front/findArticleListBySection/" + yjid + "/" + ejid + "?page=" + page;
        }
    });
	
});


function initPageInfo() {
	//异步通知公告
	var url= mainDomain + '/front/findArticleList.action';
	//通知公告
	$.post(url,{'locChannelId':6,'locThemeId':29,'rows':8},function(data){
		if(data.success == true){
			if(data.data.infoList.length > 0) {
				var infoDiv = '<ul">';
				$.each(data.data.infoList,function(i,v){
					infoDiv += '<li><a href="'+mainDomain+'/front/infoDetailPage/'+v.id+'" target="_blank">'+v.title+'</a></li>'
				});
				infoDiv += '</ul>'
					$("#noticeDiv").html(infoDiv);
			}
		}
	});
}

function findMoreInfo(channelId,themeId) {
	//异步通知公告
	var url= mainDomain + '/front/findArticleList.action';
	var pageNum = parseInt($("#pageNum").val()) + 1;
	//通知公告
	$.post(url,{'locChannelId':channelId,'locThemeId':themeId,'page':pageNum,'rows':15},function(data){
		if(data.success == true){
			if(data.data.infoList.length > 0) {
				var infoDiv = '<ul">';
				$.each(data.data.infoList,function(i,v){
					infoDiv += '<li><a href="'+mainDomain+'/front/infoDetailPage/'+v.id+'" target="_blank"><span>['+dateToStr(v.createTime)+']</span>'+v.title+'</a></li>'
				});
				infoDiv += '</ul>'
				$("#newsList").append(infoDiv);
				if(data.data.infoList.length < 15) {
					$(".fy").hide();
				}
			}
		}
	});
}

function  dateToStr(dateTime){
	if(dateTime==null){
		return "";
	}
	var date = new Date(dateTime);
	Y=date.getFullYear(); 
	M=(date.getMonth()+1)<10?("0"+(date.getMonth()+1)) : (date.getMonth()+1);
	D=date.getDate()<10?("0"+date.getDate()) : date.getDate();
	var hh = date.getHours()<10?("0"+date.getHours()) : date.getHours();
	var mm = date.getMinutes()<10?("0"+date.getMinutes()) : date.getMinutes();
	return Y+'-'+M+'-'+D; 
}
